package club.monkeywood.dataobject;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;

//spring命名规范：实体类名用驼峰，数据库表名用下划线
//否则用@Table(name="表名")注解
@Entity
@DynamicUpdate      //自动更新时间
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(of = "categoryId")
public class ProductionCategory {

    /** 类目id. */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /** 类目名字. */
    private String name;

    private Integer sellerId;

    private Date createTime;

    private Date updateTime;

    public ProductionCategory(String n) {
        name = n;
    }
}